home *** CD-ROM | disk | FTP | other *** search
/ Revista do CD-ROM 101 / CD-ROM 101.iso / compl / maya5ple / Install_MayaPLE5_English.exe / Maya / Data1.cab / ikHandleProperties.mel < prev    next >
Encoding:
Text File  |  2003-07-17  |  7.3 KB  |  322 lines

  1. // Copyright (C) 1997-2002 Alias|Wavefront,
  2. // a division of Silicon Graphics Limited.
  3. //
  4. // The information in this file is provided for the exclusive use of the
  5. // licensees of Alias|Wavefront.  Such users have the right to use, modify,
  6. // and incorporate this code into other products for purposes authorized
  7. // by the Alias|Wavefront license agreement, without fee.
  8. //
  9. // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  10. // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
  11. // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  12. // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  13. // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  14. // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  15. // PERFORMANCE OF THIS SOFTWARE.
  16. //
  17. //
  18. //  Alias|Wavefront Script File
  19. //  MODIFY THIS AT YOUR OWN RISK
  20. //
  21. //  Creation Date:    Jan. 6, 97
  22. //  Author:            ap
  23. //
  24. //  Description:    defines behaviour and layout of ikHandleContext
  25. //                    tool property sheet
  26. //
  27.  
  28.  
  29. global proc ikHandleHSetCallbacks (string $parent)
  30. //
  31. //    Procedure Name:
  32. //        ikHandleHSetCallbacks
  33. //
  34. //    Description:
  35. //        associate control events with callbacks
  36. //
  37. //    Input Arguments:
  38. //        parent name.
  39. //
  40. //    Return Value:
  41. //        None.
  42. //
  43. {
  44.     setParent    $parent;
  45.  
  46.     optionMenuGrp -e
  47.         -cc `CBG "ikHandleH" $parent "selectedIKSolver"`
  48.         ikHandleHOptionMenu;
  49.  
  50.     checkBoxGrp -e
  51.         -on1 `CBG "ikHandleH" $parent "autoPriorityOn"`
  52.         -of1 `CBG "ikHandleH" $parent "autoPriorityOff"`
  53.         autoPriorityGrp;
  54.  
  55.     checkBoxGrp -e
  56.         -on1 `CBG "ikHandleH" $parent "snapHandleHOn"`
  57.         -of1 `CBG "ikHandleH" $parent "snapHandleHOff"`
  58.         snapHandleGrp;
  59.  
  60.     checkBoxGrp -e
  61.         -on1 `CBG "ikHandleH" $parent "forceSolverHOn"`
  62.         -of1 `CBG "ikHandleH" $parent "forceSolverHOff"`
  63.         forceSolverGrp;
  64.  
  65.     //=====================================================
  66.     // For maya1.0, there is not superSticky yet. So in UI,
  67.     // use checkBox to turn on/off sticky.
  68.     //
  69.     // Use radioButtonGrp when implementing superSticky.
  70.     //=====================================================
  71.     //radioButtonGrp -e
  72.     //  -on1 `CBG "ikHandleProp" $parent "stickyOff"`
  73.     //  -on2 `CBG "ikHandleProp" $parent "stickySticky"`
  74.     //  -on3 `CBG "ikHandleProp" $parent "stickySuperSticky"`
  75.     //  stickyGrp;
  76.     checkBoxGrp -e
  77.         -on1 `CBG "ikHandleH" $parent "stickyHOn"`
  78.         -of1 `CBG "ikHandleH" $parent "stickyHOff"`
  79.         stickyGrp;
  80.  
  81.     intSliderGrp -e
  82.         -cc `CBG "ikHandleH" $parent "priorityHValue"`
  83.         priority;
  84.  
  85.     floatSliderGrp -e
  86.         -cc `CBG "ikHandleH" $parent "weightHValue"`
  87.         handleWeight;
  88.  
  89.     floatSliderGrp -e
  90.         -cc `CBG "ikHandleH" $parent "poWeightHValue"`
  91.         handlePOWeight;
  92.  
  93.     return;
  94. }
  95.  
  96. global proc ikHandleHOptionLayout(string $parentN, int $cl )
  97. //
  98. //    Procedure Name:
  99. //        ikHandleHOptionLayout
  100. //
  101. //    Description:
  102. //        jointTool property sheet shares this proc to create ikHandle part.
  103. //
  104. {
  105.     string    $parent;
  106.     string    $solvers[];
  107.     string    $solverType;
  108.     int        $i, $itemNum;
  109.  
  110.     setParent $parentN;
  111.  
  112.     setUITemplate -pushTemplate OptionsTemplate;
  113.  
  114.     frameLayout -cll true -cl $cl -l "IK Handle Settings" ikHandleHFrame;
  115.         columnLayout ikHandleHOptions;
  116.             separator -style "none";
  117.             $parent = `setParent -query`;
  118.  
  119.             optionMenuGrp -l "Current Solver" ikHandleHOptionMenu;
  120.             $solvers = `ikSystem -q -ls`;
  121.             $itemNum = 0;
  122.             for( $i = 0; $i < size($solvers); $i++ )
  123.             {
  124.                 $solverType = `objectType $solvers[$i]`;
  125.                 if( $solverType != "ikSplineSolver" )
  126.                 {
  127.                     menuItem -l $solvers[$i] ($solvers[$i] + $itemNum);
  128.                     $itemNum++;
  129.                 }
  130.             }
  131.  
  132.             separator -hr true sep1;
  133.  
  134.             checkBoxGrp
  135.                 -label ""
  136.                 -numberOfCheckBoxes 1
  137.                 -l1 "Autopriority"
  138.                 autoPriorityGrp;
  139.  
  140.             checkBoxGrp
  141.                 -label ""
  142.                 -numberOfCheckBoxes 1
  143.                 -l1 "Solver Enable"
  144.                 forceSolverGrp;
  145.  
  146.             checkBoxGrp
  147.                 -label ""
  148.                 -numberOfCheckBoxes 1
  149.                 -l1 "Snap Enable"
  150.                 snapHandleGrp;
  151.  
  152.             //=====================================================
  153.             // For maya1.0, there is not superSticky yet. So in UI,
  154.             // use checkBox to turn on/off sticky.
  155.             //
  156.             // Use radioButtonGrp when implementing superSticky.
  157.             //=====================================================
  158.             //radioButtonGrp
  159.             //  -label "Stickies "
  160.             //  -numberOfRadioButtons 3
  161.             //  -labelArray3 "Off" "Sticky" "Super Sticky"
  162.             //  -columnWidth4 150 80 80 120
  163.             //  stickyGrp;
  164.             checkBoxGrp
  165.                 -label ""
  166.                 -numberOfCheckBoxes 1
  167.                 -l1 "Sticky"
  168.                 stickyGrp;
  169.  
  170.             separator -hr true sep2;
  171.  
  172.             intSliderGrp
  173.                 -field 1
  174.                 -label "Priority"
  175.                 -minValue 0
  176.                 -value 1
  177.                 priority;
  178.  
  179.             floatSliderGrp
  180.                 -field 1
  181.                 -label "Weight"
  182.                 -minValue 0.0
  183.                 -maxValue 100.0
  184.                 -step 0.1
  185.                 -value 1.0
  186.                 handleWeight;
  187.  
  188.             floatSliderGrp
  189.                 -field 1
  190.                 -label "POWeight"
  191.                 -minValue 0.0
  192.                 -maxValue 1.0
  193.                 -step 0.001
  194.                 -value 1.0
  195.                 handlePOWeight;
  196.  
  197.         setParent ..; // ikHandleHOptions
  198.     setParent ..; // ikHandleHFrame
  199.  
  200.     setUITemplate -popTemplate;
  201.  
  202.     ikHandleHSetCallbacks( $parent );
  203.  
  204.     clear($solvers);
  205.  
  206.     return;
  207. }
  208.  
  209.  
  210. global proc ikHandleProperties ()
  211. //
  212. //    Procedure Name:
  213. //        ikHandleProperties
  214. //
  215. //    Description:
  216. //        layout of tool property sheet
  217. //
  218. //    Input Arguments:
  219. //        None.
  220. //
  221. //    Return Value:
  222. //        None.
  223. //
  224. {
  225.     setUITemplate -pushTemplate DefaultTemplate;
  226.  
  227.     string $parent = `toolPropertyWindow -q -location`;
  228.     setParent $parent;
  229.  
  230.     columnLayout ikHandle;
  231.         $parent = `setParent -query`;
  232.         ikHandleHOptionLayout( $parent, false );
  233.     setParent ..; // ikHandle
  234.  
  235.     setUITemplate -popTemplate;
  236.  
  237.     return;
  238. }
  239.  
  240.  
  241. global proc ikHandleHCallback(string $parent, string $whichCallback)
  242. //
  243. //    Procedure Name:
  244. //        ikHandleHCallback
  245. //
  246. //    Description:
  247. //        Callbacks for the IK Handle Tool Property Sheet.
  248. //
  249. //    Input Arguments:
  250. //        Parent name, and
  251. //        current callback name.
  252. //
  253. //    Return Value:
  254. //        None.
  255. //
  256. {
  257.     setParent    $parent;
  258.     string        $whichCtx = `currentCtx`;
  259.  
  260.     switch ($whichCallback)
  261.     {
  262.         case "selectedIKSolver":
  263.             string $solverName = `optionMenuGrp -q -value ikHandleHOptionMenu`;
  264.             ikHandleCtx -e -solverTypeH $solverName $whichCtx;
  265.             break;
  266.  
  267.         case "autoPriorityOn":
  268.             intSliderGrp -e -enable false priority;
  269.             ikHandleCtx -e -autoPriorityH true $whichCtx;
  270.             break;
  271.  
  272.         case "autoPriorityOff":
  273.             intSliderGrp -e -enable true priority;
  274.             ikHandleCtx -e -autoPriorityH false $whichCtx;
  275.             break;
  276.  
  277.         case "snapHandleHOn":
  278.             ikHandleCtx -e -snapHandleH true $whichCtx;
  279.             break;
  280.  
  281.         case "snapHandleHOff":
  282.             ikHandleCtx -e -snapHandleH false $whichCtx;
  283.             break;
  284.  
  285.         case "forceSolverHOn":
  286.             ikHandleCtx -e -forceSolverH true $whichCtx;
  287.             break;
  288.  
  289.         case "forceSolverHOff":
  290.             ikHandleCtx -e -forceSolverH false $whichCtx;
  291.             break;
  292.  
  293.         case "stickyHOn":
  294.             ikHandleCtx -e -stickyH sticky $whichCtx;
  295.             break;
  296.  
  297.         case "stickyHOff":
  298.             ikHandleCtx -e -stickyH off $whichCtx;
  299.             break;
  300.  
  301.         case "priorityHValue":
  302.             int $p = `intSliderGrp -q -v priority`;
  303.             ikHandleCtx -e -priorityH $p $whichCtx;
  304.             break;
  305.  
  306.         case "weightHValue":
  307.             float $w = `floatSliderGrp -q -v handleWeight`;
  308.             ikHandleCtx -e -weightH $w $whichCtx;
  309.             break;
  310.  
  311.         case "poWeightHValue":
  312.             float $pow = `floatSliderGrp -q -v handlePOWeight`;
  313.             ikHandleCtx -e -poWeightH $pow $whichCtx;
  314.             break;
  315.     }
  316. }
  317.  
  318.  
  319.  
  320.  
  321.  
  322.